/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import agh.rozproszony.model.Reservation;
import agh.rozproszony.reservations.ReservationsServer;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Marcin_PC
 */
public class ReservationRowWrapper {

    String room;
    String owner;
    String date;
    String timeFrom;
    String timeTo;

    public String getRoom() {
        return room;
    }

    public void setRoom(String room) {
        this.room = room;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getTimeFrom() {
        return timeFrom;
    }

    public void setTimeFrom(String timeFrom) {
        this.timeFrom = timeFrom;
    }

    public String getTimeTo() {
        return timeTo;
    }

    public void setTimeTo(String timeTo) {
        this.timeTo = timeTo;
    }

    public ReservationRowWrapper(Reservation reservation, ReservationsServer server) {
        try {
            room = server.getReservationRoomName(reservation.getId());
            owner = server.getReservationOwnerLogin(reservation.getId());

          
            date = reservation.getYear()+"/"+reservation.getMonth()+"/"+reservation.getDay();
            Double timeFrom_ = new Double(reservation.getFromHour());

            timeFrom = timeFrom_.toString();

            Double timeTo_ = new Double(reservation.getToHour());

            timeTo = timeTo_.toString();
        } catch (RemoteException ex) {
            Logger.getLogger(ReservationRowWrapper.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(ReservationRowWrapper.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
